#!/usr/bin/env python
import sm
import sys, os, os.path, re, hashlib
import multiprocessing
import Config

def delete(configfn):
    config = Config.Config(configfn)
    session = sm.Session(config.email, config.password)
    session.login()

    CategoriesInstance = sm.Categories(session)
    category = CategoriesInstance.getCategoriesByName(config.category)
    AlbumsInstance = sm.Albums(session)
    albums = AlbumsInstance.getAlbumsByCategoryID(category['id'])
    for i,album in enumerate(albums):
        print i,len(albums),'deleting title:',album['Title'],album['id'], album['Key']
        AlbumsInstance.deleteAlbum(album['id'])

def main():
    if len(sys.argv) != 2:
        print >>sys.stderr, 'delete.py <upload.config>'
        return
    delete(sys.argv[1])
    
if __name__ == '__main__':
    main()

# vim: set ai et sw=4 ts=4 sts=4 hlsearch
